package retry;

import loadBalancer.ConsistentHashBalancer;
import loadBalancer.LoadBalance;
import spi.SpiLoader;

/**
 * 重试机制工厂
 */
public class RetryStrategyFactory {
    private static final RetryStrategy DEFAULT_RETRY_STRATEGY = new FixedTimeIntervalStrategy();
    static {
        SpiLoader.load(RetryStrategy.class);
    }

    /**
     * 根据重试机制对应的种类key，获取对应的重试机制对象（默认采取spi机制）
     * @param retryStrategyKey
     * @return
     */
    public static RetryStrategy getInstance(String retryStrategyKey){
        return SpiLoader.getInstance(RetryStrategy.class,retryStrategyKey);
    }
}
